package china;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanNameGenerator;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.annotation.*;
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Indexed;

import java.lang.annotation.*;
import java.util.function.Predicate;

 public class MakerApplication implements ImportSelector {

	@Override
	public String[] selectImports(AnnotationMetadata importingClassMetadata) {
		return new String[]{
				"china.MakerApplication.MakerImportSelector",
		};
	}

	@Override
	public Predicate<String> getExclusionFilter() {
		return null;
	}
	 @Target(ElementType.TYPE)
	 @Retention(RetentionPolicy.RUNTIME)
	 @Documented
	 @Indexed
	 @Should2
	 public @interface Should {

		 String value() default "";

	 }
	 @Target(ElementType.TYPE)
	 @Retention(RetentionPolicy.RUNTIME)
	 @Documented
	 @Indexed
	 public @interface Should2 {

		 String value() default "";

	 }
	 interface AAA{

	 }
	private static class DDD{}
	 @EnableAspectJAutoProxy
	 @Should
	 public static class Cai extends  DDD implements AAA {


		private class BB{}
		@Bean("obj")
		 public Object ob(){
			return new Object();
		}
	 }

	public static class MakerImportBeanDefinitionRegistrar {

	}

	@Import(Cai.class)
	public static class MakerImportSelector {

	}
	@Component
	public static class MakerComponent {

	}
 	public static class Maker implements ImportBeanDefinitionRegistrar {
		@Override
		public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry, BeanNameGenerator importBeanNameGenerator) {
			GenericBeanDefinition genericBeanDefinition = new GenericBeanDefinition();
			genericBeanDefinition.setBeanClass(MakerImportBeanDefinitionRegistrar.class);
			registry.registerBeanDefinition("makerImportBeanDefinitionRegistrar",genericBeanDefinition);
		}
	}







}
